//
//  SYS_HomeView.m
//  System_App
//
//  Created by 吴健 on 2017/11/28.
//  Copyright © 2017年 czy001. All rights reserved.
//

#import "SYS_HomeView.h"

@implementation SYS_HomeView

- (id)initWithFrame:(CGRect)frame{
    if (self == [super initWithFrame:frame]) {
        [self setUI];
    }
    return self;
}

#pragma mark -- setter and getter
- (void)setUI{
    self.backgroundColor = DSCOLOR_GRAY_BACKGROUND;
    
    UIImageView *headImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, SCREENWIDTH, 180)];
    headImage.image = WJIMAGE(@"home_head");
    [self addSubview:headImage];
    
    UIView *v_bg = [[UIView alloc] initWithFrame:CGRectMake(20, 155, SCREENWIDTH-40, 50)];
    v_bg.backgroundColor = DSCOLOR_WHITE;
    [self addSubview:v_bg];
    
    v_bg.layer.masksToBounds = YES;
    v_bg.layer.cornerRadius  = 25.0f;
    
    //营业额图标
    UIImageView *imv_turnover = [UIImageView new];
    imv_turnover.image = WJIMAGE(@"home_turnover");
    [v_bg addSubview:imv_turnover];
    imv_turnover.sd_layout
    .leftSpaceToView(v_bg, 10)
    .centerYEqualToView(v_bg)
    .widthIs(30)
    .heightIs(30);
    
    UILabel *lb_title = [UILabel new];
    lb_title.font = DSFONT_DETAIL;
    lb_title.text = @"今日订单总额(元)：";
    [v_bg addSubview:lb_title];
    lb_title.sd_layout
    .leftSpaceToView(imv_turnover, 5)
    .centerYEqualToView(v_bg)
    .widthIs(125)
    .heightIs(20);
    
    _totalPriceLabel = [UILabel new];
    _totalPriceLabel.font = DSFONT_MIN;
    _totalPriceLabel.text = @"订单总额:502231.38";
    _totalPriceLabel.textColor = DSCOLOR_GARY_TITLE;
    [v_bg addSubview:_totalPriceLabel];
    
    _totalPriceLabel.sd_layout
    .leftSpaceToView(lb_title, 0)
    .rightSpaceToView(v_bg, 10)
    .bottomSpaceToView(v_bg, 5)
    .heightIs(15);
    
    _todayPriceLabel = [UILabel new];
    _todayPriceLabel.font = [UIFont systemFontOfSize:20];
    _todayPriceLabel.textColor =DSCOLOR_RED;
    _todayPriceLabel.text = @"266655.85";
    [v_bg addSubview:_todayPriceLabel];
    
    _todayPriceLabel.sd_layout
    .leftSpaceToView(lb_title, 0)
    .rightSpaceToView(v_bg, 10)
    .topSpaceToView(v_bg, 5)
    .bottomSpaceToView(_totalPriceLabel, 5);
    
    
}

@end
